
package com.naza.rpc.netty.handler;

import com.naza.rpc.netty.RpcSendHandler;
import com.naza.rpc.serialize.kryo.KryoCodecUtil;
import com.naza.rpc.serialize.kryo.KryoDecoder;
import com.naza.rpc.serialize.kryo.KryoEncoder;
import com.naza.rpc.serialize.kryo.KryoPoolFactory;
import io.netty.channel.ChannelPipeline;

/**
 * RPC客户端 Kryo 编解码 处理(RpcSendHandler)
 * 
 * @author yl
 */
public class KryoSendHandler implements NazaSendHandler {
    @Override
    public void handle(ChannelPipeline pipeline) {
        KryoCodecUtil util = new KryoCodecUtil(KryoPoolFactory.getKryoPoolInstance());
        pipeline.addLast(new KryoEncoder(util));
        pipeline.addLast(new KryoDecoder(util));
        pipeline.addLast(new RpcSendHandler());
    }
}
